code_v1.Rcode_v1b_add_plot.Rcode_v1b_add_plot_FINAL.Rcode_v1b_add_plot_FINAL_FINALv2_sept2020.Rcode_v1b_add_plot_FINAL_FINALv2_sept2020_Maria.RStandardized naming convention
0.1-ptg-exciting-report.txt
0.2-ptg-exciting-report.txt
1.0-ptg-exciting-report.txt (finalised version)
1.1-ptg-exciting-report.txt (revision)
<project-name>
| CHANGELOG.txt
└───current
│ │ code.R
| | report.txt
└───2023-06-13
| | code.R
| | report.txt
└───2023-06-12
| | code.R
| | report.txt
CHANGELOG.txt
* _2023_06_13
* Fix: resolved a minor bug which prevented...
* _2023_06_12
* Feature: added a new function which does...
Versioning manually requires a lot of self-discipline
Combining versions manually is hard work
Might need a version control system such as Git
Widely used Version Control System
Automatically tracks changes in your project
Changes by multiple people can be combined into a single file
Backups stored securely & remotely
Think about e-mail… we could host our own e-mail server, but that’s usually too much effort
Git is like e-mail
GitLab & GitHub are like gmail or yahoo
There are other git hosting services
Today we’ll focus on GitHub
GitHub uses personal access tokens (PATs) as a secure method of authentication
A PAT is an auto-generated strong passphrase (not ‘monkey123’!)
The user can set an automatic expiry date and different permissions for each token
This guide explains how to set one up in GitHub (make sure to select ‘repo’ when setting the scopes)
There are a couple of different ways that we can start using a Git repository:
Downloads a copy of that repository to your machine
Takes the latest snapshot available (all of the files) from GitHub
By default saved in a folder with the same name as the repository
“Using a Git commit is like using anchors and other protection when climbing. If you’re crossing a dangerous rock face you want to make sure you’ve used protection to catch you if you fall. Commits play a similar role: if you make a mistake, you can’t fall past the previous commit. —”
We are going to:
Edit & save some files in our working directory
Add these changes to the staging area
Commit the changes in the staging area to our local repository
Now we are going to:
Sometimes it’s not as simple as we just said
Git can often automatically pull and merge changes
If it can’t you get a merge conflict
If a merge conflict occurs, we have to manually fix it.
Project management
Continuous Integration
Automated deployments
Security
Here we pushed changes to the remote main branch
main should always have working code
In reality we would make commits to a separate branch & then create a pull request